package com.project.service.Impl;

import java.io.File;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import com.project.dao.ProductDao;
import com.project.service.ProductService;
import com.project.vo.Picture;
import com.project.vo.Product;

public class ProductServiceImpl implements ProductService {

	private ProductDao productDao;
	public ProductDao getProductDao() {
		return productDao;
	}
	public void setProductDao(ProductDao productDao) {
		this.productDao = productDao;
	}
	
	@Override
	public List<Product> queryAllByUserId(Integer user_id, int pageSize, int pageNum) {
		// TODO Auto-generated method stub
		List<Product> products = new ArrayList<Product>();
		products = productDao.queryAllByUserId(user_id, pageSize, pageNum);
		return products;
	}
	@Override
	public List<Product> queryAllByUserId(Integer user_id) {
		// TODO Auto-generated method stub
		List<Product> products = new ArrayList<Product>();
		products = productDao.queryAllByUserId(user_id);
		return products;
	}
	@Override
	public Product queryById(Integer id) {
		// TODO Auto-generated method stub
		Product product = productDao.queryById(id);
		return product;
	}
	@Override
	public String delete(Integer id) {
		// TODO Auto-generated method stub
		String result = productDao.delete(id);
		return result;
	}
	@Override
	public String update(Product product, Set pic) {
		// TODO Auto-generated method stub
		String result = productDao.update(product, pic);
		return result;
	}
	@Override
	public String update(Product product, List<File> pictures, List<String> picturesFileName) {
		// TODO Auto-generated method stub
		return productDao.update(product, pictures, picturesFileName);
	}
	@Override
	public Integer getCountUserProduct(Integer userId) {
		// TODO Auto-generated method stub
		Integer result = productDao.getCountUserProduct(userId);
		return result;
	}
	public ProductServiceImpl() {
		// TODO Auto-generated constructor stub
	}
	@Override
	public String add(Product product) {
		// TODO Auto-generated method stub
		String result = productDao.add(product);
		return result;
	}
	@Override
	public String add(Product product, List<String> localPath) {
		// TODO Auto-generated method stub
		String result = productDao.add(product, localPath);
		return result;
	}
	@Override
	public String add(Product product, Set pic) {
		// TODO Auto-generated method stub
		String result = productDao.add(product, pic);
		return result;
	}
	@Override
	public String add(Product product, List<File> pictures, List<String> picturesFileName) {
		// TODO Auto-generated method stub
		return productDao.add(product, pictures, picturesFileName);
	}
	@Override
	public List<Picture> queryPictureByProductId(Integer productId) {
		// TODO Auto-generated method stub
		List<Picture> pictures = productDao.queryPictureByProductId(productId);
		return pictures;
	}
	@Override
	public String imageDelete(Integer picture_id) {
		// TODO Auto-generated method stub
		return productDao.imageDelete(picture_id);
	}
	@Override
	public List<Product> queryAllProduct() {
		// TODO Auto-generated method stub
		return productDao.queryAllProduct();
	}
	@Override
	public List<Product> queryAllProduct(Integer pageNum, Integer pageSize) {
		// TODO Auto-generated method stub
		return productDao.queryAllProduct(pageNum, pageSize);
	}

}
